//
//  DBVisitorView.swift
//  Weibo
//
//  Created by zyc on 16/6/3.
//  Copyright © 2016年 heima. All rights reserved.
//

import UIKit

class DBVisitorView: UIView {

    //添加子控件：从上往下，从左往右
    //图标
    lazy var iconView: UIImageView = UIImageView()
    
    //转圈tupian
    lazy var circleView: UIImageView = UIImageView()
    
    //遮罩图片
    lazy var maskIconView: UIImageView = UIImageView()
    
    //文字label
    lazy var textLabel: UILabel = UILabel()
    
    //注册按钮
    lazy var resitButton: UIButton = UIButton()
    
    //登录anniu
    lazy var loginButton: UIButton = UIButton()
    
    init() {
        
        super.init(frame: UIScreen.mainScreen().bounds)
        
        setUpUI()
    
    }

    required init?(coder aDecoder: NSCoder) {
        
        fatalError("init(coder:) has not been implemented")
        
    }
    
}

extension DBVisitorView {

    func setUpUI() {
    
        backgroundColor = UIColor.grayColor()
        
        //将控件添加到访客视图
        addSubview(iconView)
        
        addSubview(circleView)
        
        addSubview(maskIconView)
        
        addSubview(textLabel)
        
        addSubview(resitButton)
        
        addSubview(loginButton)
        
        //给子控件添加默认值
        iconView.image = UIImage(named: "visitordiscover_feed_image_house")
        
        circleView.image = UIImage(named: "visitordiscover_feed_image_smallicon")
        
        maskIconView.image = UIImage(named: "visitordiscover_feed_mask_smallicon")
        
        textLabel.text = "登录后，别人评论你的微博，给你发送消息，你都会收到"
        
        resitButton.setTitle("注册", forState: .Normal)
        
        loginButton.setTitle("登录", forState: .Normal)
        
        //自动布局
        //masonry是OC当中自动布局的框架。snapkit，是masonry公司出的，专门用于swift自动布局的框架。
    
    }

}

